<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK hide #-}</span><span>
</span><span id="line-3"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Distribution.Compat.CopyFile</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-4"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyFile"><span class="hs-identifier">copyFile</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-5"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyFileChanged"><span class="hs-identifier">copyFileChanged</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-6"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#filesEqual"><span class="hs-identifier">filesEqual</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-7"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyOrdinaryFile"><span class="hs-identifier">copyOrdinaryFile</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-8"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyExecutableFile"><span class="hs-identifier">copyExecutableFile</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-9"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#setFileOrdinary"><span class="hs-identifier">setFileOrdinary</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-10"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#setFileExecutable"><span class="hs-identifier">setFileExecutable</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#setDirOrdinary"><span class="hs-identifier">setDirOrdinary</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Compat.Prelude.html"><span class="hs-identifier">Distribution.Compat.Prelude</span></a></span><span class="hs-cpp">

#ifndef mingw32_HOST_OS
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Distribution.Compat.Internal.TempFile</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Exception</span><span>
</span><span id="line-21"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">bracketOnError</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Data.ByteString.Lazy</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">BSL</span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.IO.Error</span><span>
</span><span id="line-24"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">ioeSetLocation</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Directory</span><span>
</span><span id="line-26"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">doesFileExist</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">renameFile</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">removeFile</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.FilePath</span><span>
</span><span id="line-28"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">takeDirectory</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.IO</span><span>
</span><span id="line-30"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">IOMode</span><span class="hs-special">(</span><span class="hs-identifier">ReadMode</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hClose</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hGetBuf</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hPutBuf</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hFileSize</span><span>
</span><span id="line-31"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">withBinaryFile</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign</span><span>
</span><span id="line-33"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Posix.Types</span><span>
</span><span id="line-36"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">FileMode</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Posix.Internals</span><span>
</span><span id="line-38"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">c_chmod</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">withFilePath</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.C</span><span>
</span><span id="line-40"></span><span>         </span><span class="hs-special">(</span><span> </span><span class="hs-identifier">throwErrnoPathIfMinus1_</span><span> </span><span class="hs-special">)</span><span class="hs-cpp">

#else /* else mingw32_HOST_OS */
</span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Lazy.html#"><span class="hs-identifier">Data.ByteString.Lazy</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">BSL</span></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Error.html#"><span class="hs-identifier">System.IO.Error</span></a></span><span>
</span><span id="line-46"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Error.html#ioeSetLocation"><span class="hs-identifier">ioeSetLocation</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#"><span class="hs-identifier">System.Directory</span></a></span><span>
</span><span id="line-48"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../directory/src/System.Directory.html#doesFileExist"><span class="hs-identifier">doesFileExist</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#addTrailingPathSeparator"><span class="hs-identifier">addTrailingPathSeparator</span></a></span><span>
</span><span id="line-51"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#hasTrailingPathSeparator"><span class="hs-identifier">hasTrailingPathSeparator</span></a></span><span>
</span><span id="line-52"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#isPathSeparator"><span class="hs-identifier">isPathSeparator</span></a></span><span>
</span><span id="line-53"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#isRelative"><span class="hs-identifier">isRelative</span></a></span><span>
</span><span id="line-54"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#joinDrive"><span class="hs-identifier">joinDrive</span></a></span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#joinPath"><span class="hs-identifier">joinPath</span></a></span><span>
</span><span id="line-56"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#pathSeparator"><span class="hs-identifier">pathSeparator</span></a></span><span>
</span><span id="line-57"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#pathSeparators"><span class="hs-identifier">pathSeparators</span></a></span><span>
</span><span id="line-58"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#splitDirectories"><span class="hs-identifier">splitDirectories</span></a></span><span>
</span><span id="line-59"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#splitDrive"><span class="hs-identifier">splitDrive</span></a></span><span>
</span><span id="line-60"></span><span>  </span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span>
</span><span id="line-62"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.IOMode.html#IOMode"><span class="hs-identifier">IOMode</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.IOMode.html#ReadMode"><span class="hs-identifier">ReadMode</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.html#hFileSize"><span class="hs-identifier">hFileSize</span></a></span><span>
</span><span id="line-63"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#withBinaryFile"><span class="hs-identifier">withBinaryFile</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../Win32/src/System.Win32.File.html#"><span class="hs-identifier">System.Win32.File</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Win32</span></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../Win32/src/System.Win32.File.html#copyFile"><span class="hs-identifier">copyFile</span></a></span><span> </span><span class="hs-special">)</span><span class="hs-cpp">
#endif /* mingw32_HOST_OS */
</span><span>
</span><span id="line-68"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyOrdinaryFile"><span class="hs-identifier hs-type">copyOrdinaryFile</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyExecutableFile"><span class="hs-identifier hs-type">copyExecutableFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span id="copyOrdinaryFile"><span class="annot"><span class="annottext">copyOrdinaryFile :: [Char] -&gt; [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#copyOrdinaryFile"><span class="hs-identifier hs-var hs-var">copyOrdinaryFile</span></a></span></span><span>   </span><span id="local-6989586621679626586"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626586"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621679626585"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626585"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#copyFile"><span class="hs-identifier hs-var">copyFile</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626586"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626585"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO () -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#setFileOrdinary"><span class="hs-identifier hs-var">setFileOrdinary</span></a></span><span>   </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626585"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-70"></span><span id="copyExecutableFile"><span class="annot"><span class="annottext">copyExecutableFile :: [Char] -&gt; [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#copyExecutableFile"><span class="hs-identifier hs-var hs-var">copyExecutableFile</span></a></span></span><span> </span><span id="local-6989586621679626584"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626584"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621679626583"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626583"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#copyFile"><span class="hs-identifier hs-var">copyFile</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626584"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626583"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="annot"><span class="annottext">IO () -&gt; IO () -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#setFileExecutable"><span class="hs-identifier hs-var">setFileExecutable</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626583"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#setFileOrdinary"><span class="hs-identifier hs-type">setFileOrdinary</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#setFileExecutable"><span class="hs-identifier hs-type">setFileExecutable</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Compat.CopyFile.html#setDirOrdinary"><span class="hs-identifier hs-type">setDirOrdinary</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">
#ifndef mingw32_HOST_OS
</span><span class="hs-identifier">setFileOrdinary</span><span>   </span><span class="hs-identifier">path</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">setFileMode</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-number">0o644</span><span> </span><span class="hs-comment">-- file perms -rw-r--r--</span><span>
</span><span id="line-75"></span><span class="hs-identifier">setFileExecutable</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">setFileMode</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-number">0o755</span><span> </span><span class="hs-comment">-- file perms -rwxr-xr-x</span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span class="hs-identifier">setFileMode</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FilePath</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FileMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-78"></span><span class="hs-identifier">setFileMode</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">m</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-79"></span><span>  </span><span class="hs-identifier">withFilePath</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-identifier">throwErrnoPathIfMinus1_</span><span> </span><span class="hs-string">&quot;setFileMode&quot;</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">c_chmod</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-identifier">m</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span id="setFileOrdinary"><span class="annot"><span class="annottext">setFileOrdinary :: [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#setFileOrdinary"><span class="hs-identifier hs-var hs-var">setFileOrdinary</span></a></span></span><span>   </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-83"></span><span id="setFileExecutable"><span class="annot"><span class="annottext">setFileExecutable :: [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#setFileExecutable"><span class="hs-identifier hs-var hs-var">setFileExecutable</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-comment">-- This happens to be true on Unix and currently on Windows too:</span><span>
</span><span id="line-86"></span><span id="setDirOrdinary"><span class="annot"><span class="annottext">setDirOrdinary :: [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#setDirOrdinary"><span class="hs-identifier hs-var hs-var">setDirOrdinary</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#setFileExecutable"><span class="hs-identifier hs-var">setFileExecutable</span></a></span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="hs-comment">-- | Copies a file to a new destination.</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- Often you should use `copyFileChanged` instead.</span><span>
</span><span id="line-90"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyFile"><span class="hs-identifier hs-type">copyFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span id="copyFile"><span class="annot"><span class="annottext">copyFile :: [Char] -&gt; [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#copyFile"><span class="hs-identifier hs-var hs-var">copyFile</span></a></span></span><span> </span><span id="local-6989586621679626582"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626582"><span class="hs-identifier hs-var">fromFPath</span></a></span></span><span> </span><span id="local-6989586621679626581"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626581"><span class="hs-identifier hs-var">toFPath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-92"></span><span>  </span><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621679626580"><span class="hs-identifier hs-var">copy</span></a></span><span>
</span><span id="line-93"></span><span>    </span><span class="annot"><span class="annottext">IO () -&gt; (IOError -&gt; IO ()) -&gt; IO ()
forall a. IO a -&gt; (IOError -&gt; IO a) -&gt; IO a
</span><a href="Distribution.Compat.Exception.html#catchIO"><span class="hs-operator hs-var">`catchIO`</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679626578"><span class="annot"><span class="annottext">IOError
</span><a href="#local-6989586621679626578"><span class="hs-identifier hs-var">ioe</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; IO ()
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IOError -&gt; [Char] -&gt; IOError
</span><a href="../../base/src/System.IO.Error.html#ioeSetLocation"><span class="hs-identifier hs-var">ioeSetLocation</span></a></span><span> </span><span class="annot"><span class="annottext">IOError
</span><a href="#local-6989586621679626578"><span class="hs-identifier hs-var">ioe</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;copyFile&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-keyword">where</span><span class="hs-cpp">
#ifndef mingw32_HOST_OS
</span><span>      </span><span class="hs-identifier">copy</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">withBinaryFile</span><span> </span><span class="hs-identifier">fromFPath</span><span> </span><span class="hs-identifier">ReadMode</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">hFrom</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-97"></span><span>             </span><span class="hs-identifier">bracketOnError</span><span> </span><span class="hs-identifier">openTmp</span><span> </span><span class="hs-identifier">cleanTmp</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="hs-identifier">tmpFPath</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hTmp</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-98"></span><span>             </span><span class="hs-keyword">do</span><span> </span><span class="hs-identifier">allocaBytes</span><span> </span><span class="hs-identifier">bufferSize</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">copyContents</span><span> </span><span class="hs-identifier">hFrom</span><span> </span><span class="hs-identifier">hTmp</span><span>
</span><span id="line-99"></span><span>                </span><span class="hs-identifier">hClose</span><span> </span><span class="hs-identifier">hTmp</span><span>
</span><span id="line-100"></span><span>                </span><span class="hs-identifier">renameFile</span><span> </span><span class="hs-identifier">tmpFPath</span><span> </span><span class="hs-identifier">toFPath</span><span>
</span><span id="line-101"></span><span>      </span><span class="hs-identifier">openTmp</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">openBinaryTempFile</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">takeDirectory</span><span> </span><span class="hs-identifier">toFPath</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;.copyFile.tmp&quot;</span><span>
</span><span id="line-102"></span><span>      </span><span class="hs-identifier">cleanTmp</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">tmpFPath</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">hTmp</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-103"></span><span>        </span><span class="hs-identifier">hClose</span><span> </span><span class="hs-identifier">hTmp</span><span>          </span><span class="hs-special">`</span><span class="hs-identifier">catchIO</span><span class="hs-special">`</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>        </span><span class="hs-identifier">removeFile</span><span> </span><span class="hs-identifier">tmpFPath</span><span>  </span><span class="hs-special">`</span><span class="hs-identifier">catchIO</span><span class="hs-special">`</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-105"></span><span>      </span><span class="hs-identifier">bufferSize</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">4096</span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span>      </span><span class="hs-identifier">copyContents</span><span> </span><span class="hs-identifier">hFrom</span><span> </span><span class="hs-identifier">hTo</span><span> </span><span class="hs-identifier">buffer</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-108"></span><span>              </span><span class="hs-identifier">count</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">hGetBuf</span><span> </span><span class="hs-identifier">hFrom</span><span> </span><span class="hs-identifier">buffer</span><span> </span><span class="hs-identifier">bufferSize</span><span>
</span><span id="line-109"></span><span>              </span><span class="hs-identifier">when</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">count</span><span> </span><span class="hs-operator">&gt;</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-110"></span><span>                      </span><span class="hs-identifier">hPutBuf</span><span> </span><span class="hs-identifier">hTo</span><span> </span><span class="hs-identifier">buffer</span><span> </span><span class="hs-identifier">count</span><span>
</span><span id="line-111"></span><span>                      </span><span class="hs-identifier">copyContents</span><span> </span><span class="hs-identifier">hFrom</span><span> </span><span class="hs-identifier">hTo</span><span> </span><span class="hs-identifier">buffer</span><span class="hs-cpp">
#else
</span><span>      </span><span id="local-6989586621679626580"><span class="annot"><span class="annottext">copy :: IO ()
</span><a href="#local-6989586621679626580"><span class="hs-identifier hs-var hs-var">copy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; Bool -&gt; IO ()
</span><a href="../../Win32/src/System.Win32.File.html#copyFile"><span class="hs-identifier hs-var">Win32.copyFile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#toExtendedLengthPath"><span class="hs-identifier hs-var">toExtendedLengthPath</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626582"><span class="hs-identifier hs-var">fromFPath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-114"></span><span>                            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#toExtendedLengthPath"><span class="hs-identifier hs-var">toExtendedLengthPath</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626581"><span class="hs-identifier hs-var">toFPath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-115"></span><span>                            </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="hs-comment">-- NOTE: Shamelessly lifted from System.Directory.Internal.Windows</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="hs-comment">-- | Add the @&quot;\\\\?\\&quot;@ prefix if necessary or possible.  The path remains</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- unchanged if the prefix is not added.  This function can sometimes be used</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- to bypass the @MAX_PATH@ length restriction in Windows API calls.</span><span>
</span><span id="line-122"></span><span class="hs-comment">--</span><span>
</span><span id="line-123"></span><span class="hs-comment">-- See Note [Path normalization].</span><span>
</span><span id="line-124"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#toExtendedLengthPath"><span class="hs-identifier hs-type">toExtendedLengthPath</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-125"></span><span id="toExtendedLengthPath"><span class="annot"><span class="annottext">toExtendedLengthPath :: [Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#toExtendedLengthPath"><span class="hs-identifier hs-var hs-var">toExtendedLengthPath</span></a></span></span><span> </span><span id="local-6989586621679626575"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626575"><span class="hs-identifier hs-var">path</span></a></span></span><span>
</span><span id="line-126"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#isRelative"><span class="hs-identifier hs-var">isRelative</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626575"><span class="hs-identifier hs-var">path</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626575"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-127"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-128"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626574"><span class="hs-identifier hs-var">normalisedPath</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-129"></span><span>        </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'?'</span></span><span>  </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'?'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626574"><span class="hs-identifier hs-var">normalisedPath</span></a></span><span>
</span><span id="line-130"></span><span>        </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'?'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626574"><span class="hs-identifier hs-var">normalisedPath</span></a></span><span>
</span><span id="line-131"></span><span>        </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626574"><span class="hs-identifier hs-var">normalisedPath</span></a></span><span>
</span><span id="line-132"></span><span>        </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679626573"><span class="annot"><span class="annottext">subpath :: [Char]
</span><a href="#local-6989586621679626573"><span class="hs-identifier hs-var">subpath</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\\'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;\\\\?\\UNC&quot;</span></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626573"><span class="hs-identifier hs-var">subpath</span></a></span><span>
</span><span id="line-133"></span><span>        </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;\\\\?\\&quot;</span></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626574"><span class="hs-identifier hs-var">normalisedPath</span></a></span><span>
</span><span id="line-134"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679626574"><span class="annot"><span class="annottext">normalisedPath :: [Char]
</span><a href="#local-6989586621679626574"><span class="hs-identifier hs-var hs-var">normalisedPath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#simplifyWindows"><span class="hs-identifier hs-var">simplifyWindows</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626575"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span class="hs-comment">-- | Similar to 'normalise' but:</span><span>
</span><span id="line-137"></span><span class="hs-comment">--</span><span>
</span><span id="line-138"></span><span class="hs-comment">-- * empty paths stay empty,</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- * parent dirs (@..@) are expanded, and</span><span>
</span><span id="line-140"></span><span class="hs-comment">-- * paths starting with @\\\\?\\@ are preserved.</span><span>
</span><span id="line-141"></span><span class="hs-comment">--</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- The goal is to preserve the meaning of paths better than 'normalise'.</span><span>
</span><span id="line-143"></span><span class="hs-comment">--</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- Note [Path normalization]</span><span>
</span><span id="line-145"></span><span class="hs-comment">-- 'normalise' doesn't simplify path names but will convert / into \\</span><span>
</span><span id="line-146"></span><span class="hs-comment">-- this would normally not be a problem as once the path hits the RTS we would</span><span>
</span><span id="line-147"></span><span class="hs-comment">-- have simplified the path then.  However since we're calling the WIn32 API</span><span>
</span><span id="line-148"></span><span class="hs-comment">-- directly we have to do the simplification before the call.  Without this the</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- path Z:// would become Z:\\\\ and when converted to a device path the path</span><span>
</span><span id="line-150"></span><span class="hs-comment">-- becomes \\?\Z:\\\\ which is an invalid path.</span><span>
</span><span id="line-151"></span><span class="hs-comment">--</span><span>
</span><span id="line-152"></span><span class="hs-comment">-- This is not a bug in normalise as it explicitly states that it won't simplify</span><span>
</span><span id="line-153"></span><span class="hs-comment">-- a FilePath.</span><span>
</span><span id="line-154"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#simplifyWindows"><span class="hs-identifier hs-type">simplifyWindows</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-155"></span><span id="simplifyWindows"><span class="annot"><span class="annottext">simplifyWindows :: [Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#simplifyWindows"><span class="hs-identifier hs-var hs-var">simplifyWindows</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;&quot;</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-156"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#simplifyWindows"><span class="hs-identifier hs-var">simplifyWindows</span></a></span><span> </span><span id="local-6989586621679626571"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626571"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-157"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626570"><span class="hs-identifier hs-var">drive'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-158"></span><span>    </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;\\\\?\\&quot;</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626570"><span class="hs-identifier hs-var">drive'</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626569"><span class="hs-identifier hs-var">subpath</span></a></span><span>
</span><span id="line-159"></span><span>    </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626568"><span class="hs-identifier hs-var">simplifiedPath</span></a></span><span>
</span><span id="line-160"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-161"></span><span>    </span><span id="local-6989586621679626568"><span class="annot"><span class="annottext">simplifiedPath :: [Char]
</span><a href="#local-6989586621679626568"><span class="hs-identifier hs-var hs-var">simplifiedPath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
</span><a href="../../filepath/src/System.FilePath.Windows.html#joinDrive"><span class="hs-identifier hs-var">joinDrive</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626570"><span class="hs-identifier hs-var">drive'</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626567"><span class="hs-identifier hs-var">subpath'</span></a></span><span>
</span><span id="line-162"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679626566"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626566"><span class="hs-identifier hs-var">drive</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679626569"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626569"><span class="hs-identifier hs-var">subpath</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; ([Char], [Char])
</span><a href="../../filepath/src/System.FilePath.Windows.html#splitDrive"><span class="hs-identifier hs-var">splitDrive</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626571"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-163"></span><span>    </span><span id="local-6989586621679626570"><span class="annot"><span class="annottext">drive' :: [Char]
</span><a href="#local-6989586621679626570"><span class="hs-identifier hs-var hs-var">drive'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="#local-6989586621679626565"><span class="hs-identifier hs-var">upperDrive</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#normaliseTrailingSep"><span class="hs-identifier hs-var">normaliseTrailingSep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#normalisePathSeps"><span class="hs-identifier hs-var">normalisePathSeps</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626566"><span class="hs-identifier hs-var">drive</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span>    </span><span id="local-6989586621679626567"><span class="annot"><span class="annottext">subpath' :: [Char]
</span><a href="#local-6989586621679626567"><span class="hs-identifier hs-var hs-var">subpath'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="#local-6989586621679626562"><span class="hs-identifier hs-var">appendSep</span></a></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; [Char]) -&gt; ([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="#local-6989586621679626560"><span class="hs-identifier hs-var">avoidEmpty</span></a></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; [Char]) -&gt; ([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="#local-6989586621679626559"><span class="hs-identifier hs-var">prependSep</span></a></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; [Char]) -&gt; ([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [Char]
</span><a href="../../filepath/src/System.FilePath.Windows.html#joinPath"><span class="hs-identifier hs-var">joinPath</span></a></span><span> </span><span class="annot"><span class="annottext">([[Char]] -&gt; [Char]) -&gt; ([Char] -&gt; [[Char]]) -&gt; [Char] -&gt; [Char]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-165"></span><span>               </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626558"><span class="hs-identifier hs-var">stripPardirs</span></a></span><span> </span><span class="annot"><span class="annottext">([[Char]] -&gt; [[Char]])
-&gt; ([Char] -&gt; [[Char]]) -&gt; [Char] -&gt; [[Char]]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="Distribution.Compat.CopyFile.html#expandDots"><span class="hs-identifier hs-var">expandDots</span></a></span><span> </span><span class="annot"><span class="annottext">([[Char]] -&gt; [[Char]])
-&gt; ([Char] -&gt; [[Char]]) -&gt; [Char] -&gt; [[Char]]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626556"><span class="hs-identifier hs-var">skipSeps</span></a></span><span> </span><span class="annot"><span class="annottext">([[Char]] -&gt; [[Char]])
-&gt; ([Char] -&gt; [[Char]]) -&gt; [Char] -&gt; [[Char]]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span>
</span><span id="line-166"></span><span>               </span><span class="annot"><span class="annottext">[Char] -&gt; [[Char]]
</span><a href="../../filepath/src/System.FilePath.Windows.html#splitDirectories"><span class="hs-identifier hs-var">splitDirectories</span></a></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626569"><span class="hs-identifier hs-var">subpath</span></a></span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span>    </span><span id="local-6989586621679626565"><span class="annot"><span class="annottext">upperDrive :: [Char] -&gt; [Char]
</span><a href="#local-6989586621679626565"><span class="hs-identifier hs-var hs-var">upperDrive</span></a></span></span><span> </span><span id="local-6989586621679626553"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626553"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626553"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-169"></span><span>      </span><span id="local-6989586621679626552"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679626552"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679626551"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626551"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isAlpha"><span class="hs-identifier hs-var">isAlpha</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679626552"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; [Char] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#isPathSeparator"><span class="hs-identifier hs-var">isPathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626551"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="../../base/src/GHC.Unicode.html#toUpper"><span class="hs-identifier hs-var">toUpper</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679626552"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; [Char] -&gt; [Char]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; [Char] -&gt; [Char]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626551"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-170"></span><span>      </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626553"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-171"></span><span>    </span><span id="local-6989586621679626556"><span class="annot"><span class="annottext">skipSeps :: [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626556"><span class="hs-identifier hs-var hs-var">skipSeps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; Bool) -&gt; [[Char]] -&gt; [[Char]]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; ([Char] -&gt; Bool) -&gt; [Char] -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; [[Char]] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; [Char]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; [Char]) -&gt; [Char] -&gt; [[Char]]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="../../filepath/src/System.FilePath.Windows.html#pathSeparators"><span class="hs-identifier hs-var">pathSeparators</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>    </span><span id="local-6989586621679626558"><span class="annot"><span class="annottext">stripPardirs :: [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626558"><span class="hs-identifier hs-var hs-var">stripPardirs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626533"><span class="hs-identifier hs-var">pathIsAbsolute</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626531"><span class="hs-identifier hs-var">subpathIsAbsolute</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; Bool) -&gt; [[Char]] -&gt; [[Char]]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;..&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-174"></span><span>    </span><span id="local-6989586621679626559"><span class="annot"><span class="annottext">prependSep :: [Char] -&gt; [Char]
</span><a href="#local-6989586621679626559"><span class="hs-identifier hs-var hs-var">prependSep</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626531"><span class="hs-identifier hs-var">subpathIsAbsolute</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="../../filepath/src/System.FilePath.Windows.html#pathSeparator"><span class="hs-identifier hs-var">pathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; [Char] -&gt; [Char]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-176"></span><span>    </span><span id="local-6989586621679626560"><span class="annot"><span class="annottext">avoidEmpty :: [Char] -&gt; [Char]
</span><a href="#local-6989586621679626560"><span class="hs-identifier hs-var hs-var">avoidEmpty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626533"><span class="hs-identifier hs-var">pathIsAbsolute</span></a></span><span>
</span><span id="line-177"></span><span>                 </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626566"><span class="hs-identifier hs-var">drive</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626526"><span class="hs-identifier hs-var">hasTrailingPathSep</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- prefer &quot;C:&quot; over &quot;C:.&quot;</span><span>
</span><span id="line-178"></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#emptyToCurDir"><span class="hs-identifier hs-var">emptyToCurDir</span></a></span><span>
</span><span id="line-179"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-180"></span><span>    </span><span id="local-6989586621679626562"><span class="annot"><span class="annottext">appendSep :: [Char] -&gt; [Char]
</span><a href="#local-6989586621679626562"><span class="hs-identifier hs-var hs-var">appendSep</span></a></span></span><span> </span><span id="local-6989586621679626523"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626523"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626526"><span class="hs-identifier hs-var">hasTrailingPathSep</span></a></span><span>
</span><span id="line-181"></span><span>                  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626533"><span class="hs-identifier hs-var">pathIsAbsolute</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626523"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-182"></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="../../filepath/src/System.FilePath.Windows.html#addTrailingPathSeparator"><span class="hs-identifier hs-var">addTrailingPathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626523"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-183"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626523"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-184"></span><span>    </span><span id="local-6989586621679626533"><span class="annot"><span class="annottext">pathIsAbsolute :: Bool
</span><a href="#local-6989586621679626533"><span class="hs-identifier hs-var hs-var">pathIsAbsolute</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#isRelative"><span class="hs-identifier hs-var">isRelative</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626571"><span class="hs-identifier hs-var">path</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-185"></span><span>    </span><span id="local-6989586621679626531"><span class="annot"><span class="annottext">subpathIsAbsolute :: Bool
</span><a href="#local-6989586621679626531"><span class="hs-identifier hs-var hs-var">subpathIsAbsolute</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; [Char] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#isPathSeparator"><span class="hs-identifier hs-var">isPathSeparator</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [Char] -&gt; [Char]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626569"><span class="hs-identifier hs-var">subpath</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>    </span><span id="local-6989586621679626526"><span class="annot"><span class="annottext">hasTrailingPathSep :: Bool
</span><a href="#local-6989586621679626526"><span class="hs-identifier hs-var hs-var">hasTrailingPathSep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#hasTrailingPathSeparator"><span class="hs-identifier hs-var">hasTrailingPathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626569"><span class="hs-identifier hs-var">subpath</span></a></span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span class="hs-comment">-- | Given a list of path segments, expand @.@ and @..@.  The path segments</span><span>
</span><span id="line-189"></span><span class="hs-comment">-- must not contain path separators.</span><span>
</span><span id="line-190"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#expandDots"><span class="hs-identifier hs-type">expandDots</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-191"></span><span id="expandDots"><span class="annot"><span class="annottext">expandDots :: [[Char]] -&gt; [[Char]]
</span><a href="Distribution.Compat.CopyFile.html#expandDots"><span class="hs-identifier hs-var hs-var">expandDots</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">([[Char]] -&gt; [[Char]])
-&gt; ([[Char]] -&gt; [[Char]]) -&gt; [[Char]] -&gt; [[Char]]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-192"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-193"></span><span>    </span><span id="local-6989586621679626518"><span class="annot"><span class="annottext">go :: [[Char]] -&gt; [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626518"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679626517"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626517"><span class="hs-identifier hs-var">ys'</span></a></span></span><span> </span><span id="local-6989586621679626516"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626516"><span class="hs-identifier hs-var">xs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-194"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626516"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-195"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626517"><span class="hs-identifier hs-var">ys'</span></a></span><span>
</span><span id="line-196"></span><span>        </span><span id="local-6989586621679626515"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626515"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679626514"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626514"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-197"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626515"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-198"></span><span>            </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;.&quot;</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626517"><span class="hs-identifier hs-var">ys'</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626514"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-199"></span><span>            </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;..&quot;</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-200"></span><span>              </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626517"><span class="hs-identifier hs-var">ys'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-201"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626515"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [[Char]] -&gt; [[Char]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626517"><span class="hs-identifier hs-var">ys'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626514"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-202"></span><span>                </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;..&quot;</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626515"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [[Char]] -&gt; [[Char]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626517"><span class="hs-identifier hs-var">ys'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626514"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-203"></span><span>                </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679626513"><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626513"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626513"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626514"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-204"></span><span>            </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[[Char]] -&gt; [[Char]] -&gt; [[Char]]
</span><a href="#local-6989586621679626518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626515"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [[Char]] -&gt; [[Char]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626517"><span class="hs-identifier hs-var">ys'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[[Char]]
</span><a href="#local-6989586621679626514"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span class="hs-comment">-- | Convert to the right kind of slashes.</span><span>
</span><span id="line-207"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#normalisePathSeps"><span class="hs-identifier hs-type">normalisePathSeps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-208"></span><span id="normalisePathSeps"><span class="annot"><span class="annottext">normalisePathSeps :: [Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#normalisePathSeps"><span class="hs-identifier hs-var hs-var">normalisePathSeps</span></a></span></span><span> </span><span id="local-6989586621679626512"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626512"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679626511"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679626511"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#isPathSeparator"><span class="hs-identifier hs-var">isPathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679626511"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="../../filepath/src/System.FilePath.Windows.html#pathSeparator"><span class="hs-identifier hs-var">pathSeparator</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679626511"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; [Char] -&gt; [Char]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626512"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span class="hs-comment">-- | Remove redundant trailing slashes and pick the right kind of slash.</span><span>
</span><span id="line-211"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#normaliseTrailingSep"><span class="hs-identifier hs-type">normaliseTrailingSep</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-212"></span><span id="normaliseTrailingSep"><span class="annot"><span class="annottext">normaliseTrailingSep :: [Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#normaliseTrailingSep"><span class="hs-identifier hs-var hs-var">normaliseTrailingSep</span></a></span></span><span> </span><span id="local-6989586621679626510"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626510"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-213"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679626509"><span class="annot"><span class="annottext">path' :: [Char]
</span><a href="#local-6989586621679626509"><span class="hs-identifier hs-var hs-var">path'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626510"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-214"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679626508"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626508"><span class="hs-identifier hs-var">sep</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679626507"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626507"><span class="hs-identifier hs-var">path''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; [Char] -&gt; ([Char], [Char])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#span"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../filepath/src/System.FilePath.Windows.html#isPathSeparator"><span class="hs-identifier hs-var">isPathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626509"><span class="hs-identifier hs-var">path'</span></a></span><span>
</span><span id="line-215"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679626504"><span class="annot"><span class="annottext">addSep :: [Char] -&gt; [Char]
</span><a href="#local-6989586621679626504"><span class="hs-identifier hs-var hs-var">addSep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626508"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="../../filepath/src/System.FilePath.Windows.html#pathSeparator"><span class="hs-identifier hs-var">pathSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; [Char] -&gt; [Char]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span>
</span><span id="line-216"></span><span>  </span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; [Char]
</span><a href="#local-6989586621679626504"><span class="hs-identifier hs-var">addSep</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626507"><span class="hs-identifier hs-var">path''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="hs-comment">-- | Convert empty paths to the current directory, otherwise leave it</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- unchanged.</span><span>
</span><span id="line-220"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#emptyToCurDir"><span class="hs-identifier hs-type">emptyToCurDir</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>
</span><span id="line-221"></span><span id="emptyToCurDir"><span class="annot"><span class="annottext">emptyToCurDir :: [Char] -&gt; [Char]
</span><a href="Distribution.Compat.CopyFile.html#emptyToCurDir"><span class="hs-identifier hs-var hs-var">emptyToCurDir</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;&quot;</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;.&quot;</span></span><span>
</span><span id="line-222"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#emptyToCurDir"><span class="hs-identifier hs-var">emptyToCurDir</span></a></span><span> </span><span id="local-6989586621679626503"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626503"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626503"><span class="hs-identifier hs-var">path</span></a></span><span class="hs-cpp">
#endif /* mingw32_HOST_OS */
</span><span>
</span><span id="line-225"></span><span class="hs-comment">-- | Like `copyFile`, but does not touch the target if source and destination</span><span>
</span><span id="line-226"></span><span class="hs-comment">-- are already byte-identical. This is recommended as it is useful for</span><span>
</span><span id="line-227"></span><span class="hs-comment">-- time-stamp based recompilation avoidance.</span><span>
</span><span id="line-228"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#copyFileChanged"><span class="hs-identifier hs-type">copyFileChanged</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-229"></span><span id="copyFileChanged"><span class="annot"><span class="annottext">copyFileChanged :: [Char] -&gt; [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#copyFileChanged"><span class="hs-identifier hs-var hs-var">copyFileChanged</span></a></span></span><span> </span><span id="local-6989586621679626502"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626502"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621679626501"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626501"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-230"></span><span>  </span><span id="local-6989586621679626500"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626500"><span class="hs-identifier hs-var">equal</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; IO Bool
</span><a href="Distribution.Compat.CopyFile.html#filesEqual"><span class="hs-identifier hs-var">filesEqual</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626502"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626501"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-231"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/Control.Monad.html#unless"><span class="hs-identifier hs-var">unless</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626500"><span class="hs-identifier hs-var">equal</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; IO ()
</span><a href="Distribution.Compat.CopyFile.html#copyFile"><span class="hs-identifier hs-var">copyFile</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626502"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626501"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span class="hs-comment">-- | Checks if two files are byte-identical.</span><span>
</span><span id="line-234"></span><span class="hs-comment">-- Returns False if either of the files do not exist or if files</span><span>
</span><span id="line-235"></span><span class="hs-comment">-- are of different size.</span><span>
</span><span id="line-236"></span><span class="annot"><a href="Distribution.Compat.CopyFile.html#filesEqual"><span class="hs-identifier hs-type">filesEqual</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-237"></span><span id="filesEqual"><span class="annot"><span class="annottext">filesEqual :: [Char] -&gt; [Char] -&gt; IO Bool
</span><a href="Distribution.Compat.CopyFile.html#filesEqual"><span class="hs-identifier hs-var hs-var">filesEqual</span></a></span></span><span> </span><span id="local-6989586621679626498"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626498"><span class="hs-identifier hs-var">f1</span></a></span></span><span> </span><span id="local-6989586621679626497"><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626497"><span class="hs-identifier hs-var">f2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-238"></span><span>  </span><span id="local-6989586621679626496"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626496"><span class="hs-identifier hs-var">ex1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesFileExist"><span class="hs-identifier hs-var">doesFileExist</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626498"><span class="hs-identifier hs-var">f1</span></a></span><span>
</span><span id="line-239"></span><span>  </span><span id="local-6989586621679626495"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626495"><span class="hs-identifier hs-var">ex2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; IO Bool
</span><a href="../../directory/src/System.Directory.html#doesFileExist"><span class="hs-identifier hs-var">doesFileExist</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626497"><span class="hs-identifier hs-var">f2</span></a></span><span>
</span><span id="line-240"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626496"><span class="hs-identifier hs-var">ex1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679626495"><span class="hs-identifier hs-var">ex2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-keyword">else</span><span>
</span><span id="line-241"></span><span>    </span><span class="annot"><span class="annottext">[Char] -&gt; IOMode -&gt; (Handle -&gt; IO Bool) -&gt; IO Bool
forall r. [Char] -&gt; IOMode -&gt; (Handle -&gt; IO r) -&gt; IO r
</span><a href="../../base/src/System.IO.html#withBinaryFile"><span class="hs-identifier hs-var">withBinaryFile</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626498"><span class="hs-identifier hs-var">f1</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#ReadMode"><span class="hs-identifier hs-var">ReadMode</span></a></span><span> </span><span class="annot"><span class="annottext">((Handle -&gt; IO Bool) -&gt; IO Bool) -&gt; (Handle -&gt; IO Bool) -&gt; IO Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679626494"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679626494"><span class="hs-identifier hs-var">h1</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-242"></span><span>      </span><span class="annot"><span class="annottext">[Char] -&gt; IOMode -&gt; (Handle -&gt; IO Bool) -&gt; IO Bool
forall r. [Char] -&gt; IOMode -&gt; (Handle -&gt; IO r) -&gt; IO r
</span><a href="../../base/src/System.IO.html#withBinaryFile"><span class="hs-identifier hs-var">withBinaryFile</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679626497"><span class="hs-identifier hs-var">f2</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#ReadMode"><span class="hs-identifier hs-var">ReadMode</span></a></span><span> </span><span class="annot"><span class="annottext">((Handle -&gt; IO Bool) -&gt; IO Bool) -&gt; (Handle -&gt; IO Bool) -&gt; IO Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679626493"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679626493"><span class="hs-identifier hs-var">h2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-243"></span><span>        </span><span id="local-6989586621679626492"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679626492"><span class="hs-identifier hs-var">s1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO Integer
</span><a href="../../base/src/GHC.IO.Handle.html#hFileSize"><span class="hs-identifier hs-var">hFileSize</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679626494"><span class="hs-identifier hs-var">h1</span></a></span><span>
</span><span id="line-244"></span><span>        </span><span id="local-6989586621679626491"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679626491"><span class="hs-identifier hs-var">s2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO Integer
</span><a href="../../base/src/GHC.IO.Handle.html#hFileSize"><span class="hs-identifier hs-var">hFileSize</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679626493"><span class="hs-identifier hs-var">h2</span></a></span><span>
</span><span id="line-245"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679626492"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679626491"><span class="hs-identifier hs-var">s2</span></a></span><span>
</span><span id="line-246"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-247"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-248"></span><span>            </span><span id="local-6989586621679626489"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679626489"><span class="hs-identifier hs-var">c1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO ByteString
</span><a href="../../bytestring/src/Data.ByteString.Lazy.html#hGetContents"><span class="hs-identifier hs-var">BSL.hGetContents</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679626494"><span class="hs-identifier hs-var">h1</span></a></span><span>
</span><span id="line-249"></span><span>            </span><span id="local-6989586621679626487"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679626487"><span class="hs-identifier hs-var">c2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; IO ByteString
</span><a href="../../bytestring/src/Data.ByteString.Lazy.html#hGetContents"><span class="hs-identifier hs-var">BSL.hGetContents</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679626493"><span class="hs-identifier hs-var">h2</span></a></span><span>
</span><span id="line-250"></span><span>            </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; IO Bool) -&gt; Bool -&gt; IO Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679626489"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; ByteString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679626487"><span class="hs-identifier hs-var">c2</span></a></span><span>
</span><span id="line-251"></span></pre></body></html>